package student.service.Impl;

import java.util.Scanner;

import student.dao.StudentDao;
import student.entity.student;
import student.service.StudentService;
public class StudentServiceImpl implements StudentService{
  @Override
    public void studentAdd(){
        System.out.println("---------添加学生----------");
        student student=new student();
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入登录账号：");
        student.setStudentLoginName(scanner.next());
        System.out.println("请输入登录密码：");
        student.setStudentLoginPassword(scanner.next());
        System.out.println("请输入学生姓名：");
        student.setStudentName(scanner.next());
        System.out.println("请输入学生性别：");
        student.setStudentSex(scanner.next());
        System.out.println("请输入学生年龄：");
        student.setStudentAge(Integer.valueOf(scanner.next()));
        System.out.println("请输入学生班级：");
        student.setStudentClass(scanner.next());

    }
@Override
public void studentLogin(){
    while (true) {
        System.out.println("****************************************");
        System.out.println("      欢迎使用仁爱学院教务管理系统");
        System.out.println("                1.学生个人信息");
        System.out.println("                2.学生课表");
        System.out.println("                3.学生成绩");
        System.out.println("****************************************");
        System.out.print("请输入你的选择：");
        Scanner scanner = new Scanner(System.in);
        String next = scanner.next();
        switch (next) {
            case "1":
                System.out.println("正在进入学生个人信息页面");
                studentSelect();
                break;
            case "2":
                System.out.println("正在加载学生课表");
                studentClass();
                break;
            case "3":
                System.out.println("正在查询学生成绩");
                studentgrade();
                break;
            case "4":
                return;
            default:
        }
    }
}
    @Override
    public void studentSelect() {
        new StudentDao().studentSelect();
    }
    @Override
    public void studentClass(){

    }
    @Override
    public void studentgrade(){

    }
//@Override
//    public void studentSelect(){
//        System.out.println("----------查看学生----------");
//            try (ObjectInputStream objectInputStream = new ObjectInputStream(new FilterInputStream("src/main/resources/entity/student."))) {
//                ArrayList<student> students = (ArrayList<student>) objectInputStream.readObject();
//            } catch (ClassNotFoundException e) {
//                throw new RuntimeException(e);
//            } catch (IOException e) {
//               throw new RuntimeException(e);
//            }
//MongoCollection<Student>collection=MongoDBUtil.getConnect().getCollection("student",Student.class)
//        .withCodecRegistry(MongoDBUtil.getCodeRegistry());
//Bson studentId = Filter.eq("studentId","002");
//FindIterable<Student>students=collection.find(studentId);
// MongoCursor<Student>iterator=students.iterator();
// for(;iterator.hasNext();){
//     Student student=iterator.next();
//     System.out.println("----------学生名称："+student.getStudentName()+"----------");
//     System.out.println("              学生id："+student.getStudentId());
//    System.out.println("              学生登录账号："+student.getStudentLoginName());
//     System.out.println("              学生性别："+student.getStudentSex());
//     System.out.println("              学生年龄："+student.getStudentAge());
//     System.out.println("              学生班级："+student.getStudentClass());
// }
//}
//new StudentDao().studentSelect();
}
